package com.gl.db.jdbc;

import java.io.FileInputStream;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.Properties;
import java.util.ResourceBundle;

public class CallableStatementTest {
	private String driver;
	private String url;
	private String user;
	private String pass;
	public void initParam(String paramFile) throws Exception{
		Properties props = new Properties();
		props.load(new FileInputStream(paramFile));
		this.driver = props.getProperty("driver");
		this.url = props.getProperty("url");
		this.user = props.getProperty("user");
		this.pass = props.getProperty("pass");
	}
	
	public void execSql(String sql) throws Exception{
		Class.forName(this.driver);
		Connection conn = DriverManager.getConnection(this.url, this.user, this.pass);
		Statement stmt = conn.createStatement();
		ResultSet rs = stmt.executeQuery(sql);
		while(rs.next()){
			System.out.println("name:" + rs.getString("name"));
		}
		
	}
	public static void main(String[] args) throws Exception{
		CallableStatementTest pr = new CallableStatementTest();
		pr.initParam("src/sqlserver.properties");
		pr.execSql("select * from UPM_USER");
		
	}

}
